
clc;
clearvars;

HumanDataFileName='Data\HumanData_KonovalovData.mat';


% Env.TransitionRewardProb(2:3,4,:,t);

[Data,Head]=xlsread('../FromKonovalov/data.xlsx');
AllEnv.TNum=150;
AllEnv.TransitionProb=zeros(2,150,45,2);
AllEnv.TransitionRewardProb=zeros(4,150,45,2);
AllResponseTime=NaN(150,2,45,2);
AllASARCMat=NaN(150,5,45,2);

for i=1:length(Data)
    I=Data(i,:);
    AllEnv.TransitionProb(1,I(3),I(1),I(2))=I(11);
    AllEnv.TransitionProb(2,I(3),I(1),I(2))=I(12);
    AllEnv.TransitionRewardProb(1,I(3),I(1),I(2))=I(13);
    AllEnv.TransitionRewardProb(2,I(3),I(1),I(2))=I(14);
    AllEnv.TransitionRewardProb(3,I(3),I(1),I(2))=I(15);
    AllEnv.TransitionRewardProb(4,I(3),I(1),I(2))=I(16);
        AllResponseTime(I(3),:,I(1),I(2))=[I(10),I(17)];
    C=(I(4)==0).*(I(9)==2)+(I(4)==1).*(I(9)==3);
    AllASARCMat(I(3),:,I(1),I(2))=[I(4)+1,I(9),I(6)+1,I(8),C];
end

Env.TNum=150;
for P=1:2
ASARCMat=AllASARCMat(:,:,:,P);
ResponseTime=AllResponseTime(:,:,:,P);
Env.TransitionProb      =AllEnv.TransitionProb(:,:,:,P);
Env.TransitionRewardProb=AllEnv.TransitionRewardProb(:,:,:,P);
save([HumanDataFileName(1:end-4),'Part',num2str(P),'.mat'],'ASARCMat','Env','ResponseTime')
end